
package BLogic;

import POJOs.SCRUDBasic;
import com.sun.webui.jsf.model.Option;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author fabiofurlan
 */
public class VOptionCreator<STRUCT extends SCRUDBasic> {

    public Option[] createOptionArrayFromList(List<STRUCT> fromList){

        Iterator<STRUCT> itera=fromList.iterator();
        List<Option> optionlist=new ArrayList<Option>();
        Option[] optionaux={new Option()};

        while (itera.hasNext()) {
            STRUCT elem = itera.next();
            Option aux= new Option(elem.getId(), elem.getName()+" "+elem.getSurname());
            optionlist.add(aux);
        }


        return optionlist.toArray(optionaux);


    }

}
